 <?php include 'inc/student_head.php'; ?>






 <script type="text/html" id="toolbar">
     <button class="layui-btn layui-btn-radius layui-btn-xs layui-btn-normal" lay-event="downGame">
         &nbsp;<i class="layui-icon layui-icon-triangle-d"></i>下 载 &nbsp;
     </button>
 </script>


 <script language="javascript">
     layui.use(['form', 'element', 'table'], function() {
         var table = layui.table,
             $ = layui.$;

         $("#menu_game").addClass('layui-this'); //设置导航当前选中项的样式

         //监听工具条 下载游戏：
         table.on('tool(gamesTable)', function(obj) {
             if (obj.event === 'downGame') {
                 location.href = '/student/downGame?id=' + obj.data.id;
             };
             // 2秒后刷新页面，更新积分数值
             setTimeout(function() {
                 location.reload();
             }, 2000);
         });

         table.render({
             elem: '#gamesTable',
             id: 'games',
             url: 'game',
             method: 'post',
             //height: 460,
             width:650,
             cols: [[
                   {type: 'numbers', width: 80, title: '序 号'}
                 , {field: 'name', minwidth:240, align: 'center', sort: true, title: '游戏名称'}
                 , {field: 'price', width: 80, align: 'center', title: '分值', sort: true }
                 , {field: 'hits', width: 120, align: 'center', title: '下载量', sort: true }
                 , {toolbar: '#toolbar', width: 120, align: 'center', title: '操 作'}
                 ]],
             loading: false,
             page: false,
             // even: true
         });


// 弹出游戏表格层
layer.open({
    type: 1,
    title: '<div class="openTitle"><h2>游 戏 中 心</h2></div>',
    anim: 5,
    scrollbar: false,
    area: ['840px','550px'],
    shade: false,
    content: $('.openDiv'),
    offset:'120px',
    closeBtn: 2,
    cancel: function(index, layero){
        window.location.href="/student/index";
    }

});

     }); //end
 </script>
 <?php include 'inc/student_foot.php'; ?>


 <div class="openDiv">

     <div class="layui-row">
        <a class="y-red">同一节课下载相同的游戏不重复扣分</a>
         <div style="margin-left:98px;">
             <table class="layui-table" id="gamesTable" lay-filter="gamesTable">
             </table>
         </div>
     </div>

 </div>